跳到主要内容

Julia 抽象类型

阐述​

语法​

抽象类型指定一个类型作为基类(缺省为 Any)

abstract type «name» end
abstract type «name» <: «supertype» end

语义​

抽象类型们定义了一个 Julia 中的继承树,其顶端为 Any;已经定义好的类型可以用 <: 判断关系。抽象类型不能实例化。

实例​

abstract type Number end
abstract type Real <: Number end
abstract type AbstractFloat <: Real end
abstract type Integer <: Real end
abstract type Signed <: Integer end
abstract type Unsigned <: Integer end

性质​

相关内容​

参考文献​